

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactoryBuilder;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import Alignment.Aligner;
import Alignment.Presenter;

import trie.TrieFactoryPattern;

import lexer.BaseLexer;
import lexer.Token;


public class Controller {
	
	
	public static void main(String[] args) {
		System.out
		.println("##### ++++ Starting TokenizerTool over BaseLexer / DFA ++++ #####");
		ArrayList<Token> tokensFileOne = new ArrayList<Token>();
		ArrayList<Token> tokensFileTwo = new ArrayList<Token>();
		
		BaseLexer lexer = new BaseLexer();
		try {
			tokensFileOne = lexer.setFile("TrieWords.txt");
			tokensFileTwo = lexer.setFile("TrieWords2.txt");
		
		} catch (IOException e) {
			System.out.println("Datei nicht gefunden. Fehler im lexer.run()");
			e.printStackTrace();
		}
		
		TrieFactoryPattern factory = new TrieFactoryPattern();
		tokensFileOne = factory.addingTokensToTrie(tokensFileOne);
		tokensFileTwo = factory.addingTokensToTrie(tokensFileTwo);
		Aligner al = new Aligner(tokensFileOne, tokensFileTwo, factory);
		al.fillMatrixGround();
		al.calculateMatrix();
		al.printMatrix();
		al.runMatrixBack();
		String text1,consens,text2;
		text1 = al.getTextOne();
		consens = al.getConsens();
		text2 = al.getTextTwo();
		
//		SwingPresenter presenter = new SwingPresenter(text1,consens,text2);
//		presenter.run()
		DerFrame fr = new DerFrame(text1,consens,text2);
	}

}
